package com.dev.security.manager.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.dev.security.config.dao.BaseRepository;
import com.dev.security.manager.beans.AccountRoleUnit;
import com.dev.security.manager.beans.AccountRoleUnitId;

/**
 * @author 潜行的青衣
 * @see
 */
public interface AccountRoleUnitRepository extends BaseRepository<AccountRoleUnit, AccountRoleUnitId> {

	@Query("select aru.role.id from AccountRoleUnit aru where account_id=?1")
	public List<String> findRoleIds(String account_id);
	
	@Modifying
	@Query("delete from AccountRoleUnit where id.role_id=?1")
	public void delete(String role_id);
	
	@Modifying
	@Query("delete from AccountRoleUnit where id.account_id=?1")
	public void deleteByAccountId(String account_id);
	
}
